﻿/*----------------------------------------------------------------
    // Copyright (C) 2009 江苏华招网
    // 版权所有。 
    // 作者：庄金冬 
    //
    // 文件名：BLL_FlowEngine.cs
    // 文件功能描述：流程引擎业务逻辑类,实现接口IBLL_FlowEngine,继承自类MarshalByRefObject
    // 创建标识：庄金冬2009-03-06
    //
    // 修改标识：
    // 修改描述：
    //
    // 修改标识：
    // 修改描述：
    //
    // 审核人：
    // 审核时间：
    // 审核说明：
 //----------------------------------------------------------------*/
using System;
using System.Collections.Generic;

using System.Text;
using HZ.DrugTrade.IBLL;
using HZ.DrugTrade.Model;
using HZ.DrugTrade.DAL;
using System.Data;

namespace HZ.DrugTrade.BLL
{
    [Serializable]
    /// <summary>
    /// 用户操作业务逻辑类,实现接口IBLL_FlowEngine,继承自类MarshalByRefObject
    /// </summary>
    public class BLL_FlowEngine : MarshalByRefObject, IBLL_FlowEngine
    {

        #region IBLL_FlowEngine 成员


        /// <summary>
        /// 新增流程
        /// </summary>
        /// <remarks>（0.失败1.成功）</remarks>
        /// <param name="flow">流程</param>
        /// <returns>（0.失败1.成功）</returns>
        public int AddFlow(Flow flow)
        {
            throw new NotImplementedException();
        }


        /// <summary>
        /// 更新流程
        /// </summary>
        /// <remarks>（0.失败1.成功）</remarks>
        /// <param name="flow">流程</param>
        /// <returns>（0.失败1.成功）</returns>
        public int UpdateFlow(Flow flow)
        {
            throw new NotImplementedException();
        }


        /// <summary>
        /// 删除流程
        /// </summary>
        /// <remarks>（0.失败1.成功）</remarks>
        /// <param name="flow">流程</param>
        /// <returns>（0.失败1.成功）</returns>
        public int DelFlow(Flow flow)
        {
            throw new NotImplementedException();
        }


        /// <summary>
        /// 获取流程节点集合
        /// </summary>
        /// <param name="flowID">流程编号</param>
        /// <returns>流程节点集合</returns>
        public IList<FlowNode> GetFlowNodes(string flowID)
        {
            int totalRecord = 0;
            FlowNode node = new FlowNode()
            {
                FlowID = flowID
            };
            return DAL_FlowEngine.GetFlowNodeByWhere(node, 1, 0, out totalRecord);
        }

        /// <summary>
        /// 获取流程集合
        /// </summary>
        /// <returns>流程集合</returns>
        public IList<Flow> GetFlows()
        {
            int totalRecord=0;
           return DAL_FlowEngine.GetFlowByWhere(null, 1, 0, out totalRecord);
        }

        /// <summary>
        /// 获取流程
        /// </summary>
        /// <param name="flowID">流程编号</param>
        /// <returns>流程</returns>
        public Flow GetFlows(string flowID)
        {
            Flow flow = new Flow() { FlowID = flowID };
            int totalRecord = 0;

            IList<Flow> flowList = DAL_FlowEngine.GetFlowByWhere(flow, 1, 0, out totalRecord);
            if (totalRecord>0)
            {
                return flowList[0];
            }
            return null;
        }

        #endregion
    }
}
